/*
 * SoundLoader.hpp
 *
 *  Created on: 03.11.2013
 *      Author: dima
 */

#ifndef SOUNDLOADER_HPP_
#define SOUNDLOADER_HPP_


#include "../Globals.hpp"

#include <SDL/SDL_mixer.h>
#include <vector>
#include <string>


namespace Tanks
{

namespace Resources
{

  enum SoundType
  {
    ShootSound,
    ExplosionSound,
    TankExplosionSound,
    IdleSound,
    DriveSound,
    SoundTypeEnd
  };

  class SoundLoader
  {
  public:

    static SoundLoader & getInstance();

    Mix_Chunk * GetSound(SoundType argSoundType){ return m_sounds[argSoundType]; }

    void Load(std::string argDir);

    int GetFreeChannel();
    void FreeChannel(int argChannel){ m_freeChannels.push_back(argChannel); }

    ~SoundLoader();
  private:

    SoundLoader();

    std::vector<Mix_Chunk *> m_sounds;

    std::vector<int> m_freeChannels;

    int m_maxChannels;

  };

}

}


#endif /* SOUNDLOADER_HPP_ */
